
package com.example.yls.listview_sqlite;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class AddActivity extends AppCompatActivity {
    private EditText edtStuno;
    private EditText edtStuname;
    private EditText edtStuage;
    private Button btnSave;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_add);


        edtStuage = findViewById(R.id.edt_Stuage);
        edtStuname = findViewById(R.id.edt_Stuname);
        edtStuno = findViewById(R.id.edt_Stuno);
         btnSave = findViewById(R.id.btn_save);

         btnSave.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
            String stuno = edtStuno.getText().toString();
            String stuname = edtStuname.getText().toString();
            int stuage = Integer.parseInt(edtStuage.getText().toString());

            Intent intent = new Intent();
                 intent.putExtra("STUNO",stuno);
                 intent.putExtra("NAME",stuname);
                 intent.putExtra("AGE",stuage);

                 setResult(2001,intent);
                 finish();


             }
         });

    }
}
